<?php
require $_SERVER['DOCUMENT_ROOT'].'/../_core/common.php';

//权限验证
if( Role::init() == false ){
	exit('没有权限');
}

$db = new DB('vip');

$search = isset($_GET['search']) ? h($_GET['search']) : '';
$status_type = isset($_GET['status_type']) ? intval($_GET['status_type']) : 0;
$search_username = isset($_GET['search_username']) ? h($_GET['search_username']) : '';
$search_name = isset($_GET['search_name']) ? h($_GET['search_name']) : '';
$search_rs = array();

if($search == '搜索'){
	$search_sql = 'select * from vip_info where ';
	if($search_username != ''){
		$search_sql .= 'username like "%'.$search_username.'%" and ';
	}
	if($search_name != ''){
		$search_sql .= 'name like "%'.$search_name.'%" and ';
	}
	if($status_type != 0){
		$search_sql .= 'status='.$status_type.' and ';
	}
	$search_sql .= 'id>0 order by id desc';
	$search_rs = $db->query($search_sql)->getAll();
}

//包含模板
require template('admin/vip/vip_search');